/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package cz.muni.fi.veles.maps;

import cz.muni.fi.veles.MapServer;
import java.util.Arrays;
import java.util.Collection;
import javax.faces.component.UIComponentBase;
import javax.faces.component.behavior.ClientBehaviorHolder;
import org.richfaces.cdk.annotations.Attribute;

/**
 * Generic map component definition. Includes all common attributes,
 * which are supported by all map servers.
 * Subclasses will provide server specific services as special controls settings
 * and support for different events
 *
 * @author Jan Ferko, janferko3@gmail.com
 * @date 16.04.2011, 01:03:48
 */
public abstract class AbstractMap extends UIComponentBase implements ClientBehaviorHolder{

    public static final String COMPONENT_FAMILY = "cz.muni.fi.veles";        

    /**
     * Required attribute
     * @return latitude of map center
     */
    @Attribute(required=true, readOnly=false)
    public abstract Double getLatitude();

    /**
     * Required attribute
     * @return longitude of map center
     */
    @Attribute(required=true)
    public abstract Double getLongitude();

    /**
     * Default value: 8
     * @return initial zoom level
     */
    @Attribute(defaultValue="8")
    public abstract Integer getZoom();

    /**
     * Possible values: ROADMAP, TERRAIN, SATELLITE, HYBRID
     * @see {@link AbstractMap.MapType}
     * @return map tile layer type
     */
    @Attribute
    public abstract MapType getMapType();

    /**
     * 
     * @return css style class of map
     */
    @Attribute
    public abstract String getStyleClass();

    /**
     * Default value: true
     * @return if map is draggable
     */
    @Attribute(defaultValue="true")
    public abstract boolean isDraggable();

    /**
     * Default value: 13
     * @return maximum allowed zoom of map
     */
    @Attribute(defaultValue="13")
    public abstract Integer getMaxZoom();

    /**
     * Default value: 1
     * @return minimum allowed zoom of map
     */
    @Attribute(defaultValue="1")
    public abstract Integer getMinZoom();
    
    public abstract MapServer getMapServer();
    
    /**
     * Enumeration of possible map tile layers
     */
    public enum MapType {
        ROADMAP("roadmap"),

        SATELLITE("satellite"),

        TERRAIN("terrain"),

        HYBRID("hybrid");

        private String key;

        private MapType(String key){
            this.key = key;
        }

        public String getKey(){
            return this.key;
        }
    }

//    @Override
//    public String getDefaultEventName() {
//        return "dragend";
//    }
//
//    @Override
//    public Collection<String> getEventNames() {
//        return Arrays.asList("dragend");
//    }
    
    

}
